package unify;

import java.util.logging.Level;

import unify.fileio.Database;
import unify.fileio.FileIO;
import unify.fileio.MyLogger;
import unify.gui.SysTrayIcon;

public class Main {

	public static void main(String[] args) {
		//Logger set up
		MyLogger.setup(Level.FINEST);

		// Show Library set up
		Database.initializeDB();
		ShowLibrary showLib = ShowLibrary.getInstance();
		boolean useDatabase = true;
		if(useDatabase) {
			Database.loadShows();
		}
		else {
			FileIO file = new FileIO("shows.txt", "available.txt");		
			file.loadShows();
			file.loadAvailable();
			Database.clear();
			Database.initializeDB();
		}

		// Tray Icon setup
		SysTrayIcon.getInstance().RunIcon();
		SysTrayIcon.getInstance().trayIcon.setImageAutoSize(true);
		SysTrayIcon.getInstance().trayIcon.setToolTip("Unify, an Internet TV Tracking Program");

		// Continuous loop
		while (true) {
			showLib.doDelay();
		}
	}
}
